class ListViewAdapter {
  context = null;
  queryHandler = null;

  constructor(context) {
    this.context = context;
  }

  onFilterSubmit({ searchValue, filterParams }) {
    this.context.searchValueMx = searchValue;
    const filterResultMap = {};
    Object.keys(filterParams).forEach(filterKey => {
      if (
        filterParams[filterKey] !== null &&
        filterParams[filterKey] !== undefined &&
        filterParams[filterKey] !== '' &&
        filterParams[filterKey] !== []
      ) {
        filterResultMap[filterKey] = filterParams[filterKey];
      }
    });
    this.context.filterResultMx = filterResultMap;
  }
}

export default ListViewAdapter;
